package cn.edu.nju.software.sellerSystem;


/**
* cn/edu/nju/software/sellerSystem/_SystemBStub.java .
* �� IDL-to-Java ������������ֲ�����汾 "3.2" ���
* ���� sellerB.idl
* 2009��4��7�� ���ڶ� ����09ʱ32��35�� CST
*/

public class _SystemBStub extends org.omg.CORBA.portable.ObjectImpl implements cn.edu.nju.software.sellerSystem.SystemB
{


  /*
  		��\
  		?��?-��?z??-1?2
  			
  		?p
  			type F?{? 
  			expectedPrice  ��<
  		
  		?��
  			F?��o
  		*/
  public cn.edu.nju.software.sellerSystem.ProductInfo sentPurchaseExpection (String type, double expectedPrice)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("sentPurchaseExpection", true);
                $out.write_string (type);
                $out.write_double (expectedPrice);
                $in = _invoke ($out);
                cn.edu.nju.software.sellerSystem.ProductInfo $result = cn.edu.nju.software.sellerSystem.ProductInfoHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return sentPurchaseExpection (type, expectedPrice        );
            } finally {
                _releaseReply ($in);
            }
  } // sentPurchaseExpection


  /*
  		��\
  		?��?-��B��?3?4
  			
  		?p
  			pid F?id
  			quantity p? 
  			delivertyDate ��'?
  		
  		?��
  			/&?��.		
  		*/
  public cn.edu.nju.software.sellerSystem.PurchaseResponse requestPurchase (String pid, int quantity, cn.edu.nju.software.sellerSystem.Date deliveryDate)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("requestPurchase", true);
                $out.write_string (pid);
                $out.write_long (quantity);
                cn.edu.nju.software.sellerSystem.DateHelper.write ($out, deliveryDate);
                $in = _invoke ($out);
                cn.edu.nju.software.sellerSystem.PurchaseResponse $result = cn.edu.nju.software.sellerSystem.PurchaseResponseHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return requestPurchase (pid, quantity, deliveryDate        );
            } finally {
                _releaseReply ($in);
            }
  } // requestPurchase


  /*
  		��\
  		n��?-,��?5?6
  			
  		?p
  			?U��
  		
  		?��
  			?-U�� ?-��\?-??\B?��		
  		*/
  public cn.edu.nju.software.sellerSystem.OrderBill ackPurchase (String orderno)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("ackPurchase", true);
                $out.write_string (orderno);
                $in = _invoke ($out);
                cn.edu.nju.software.sellerSystem.OrderBill $result = cn.edu.nju.software.sellerSystem.OrderBillHelper.read ($in);
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return ackPurchase (orderno        );
            } finally {
                _releaseReply ($in);
            }
  } // ackPurchase


  /*
  		��\
  		?B?'��?9
  			
  		?p
  			?-��
  		
  		?��
  			��		
  		*/
  public void askToDeliver (String purchaseNo)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("askToDeliver", true);
                $out.write_string (purchaseNo);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                askToDeliver (purchaseNo        );
            } finally {
                _releaseReply ($in);
            }
  } // askToDeliver


  /*
  		��\
  		?��?��?14
  			
  		?p
  			?-��
  		
  		?��
  			��		
  		*/
  public void notifyDealDone (String purchaseNo)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("notifyDealDone", true);
                $out.write_string (purchaseNo);
                $in = _invoke ($out);
                return;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                notifyDealDone (purchaseNo        );
            } finally {
                _releaseReply ($in);
            }
  } // notifyDealDone


  /*
  		��\
  		??n����?16
  			
  		?p
  			?-��
  		
  		?��
  			/&��??':?'G:??	?'		
  		*/
  public boolean affirm (String purchaseNo)
  {
            org.omg.CORBA.portable.InputStream $in = null;
            try {
                org.omg.CORBA.portable.OutputStream $out = _request ("affirm", true);
                $out.write_string (purchaseNo);
                $in = _invoke ($out);
                boolean $result = $in.read_boolean ();
                return $result;
            } catch (org.omg.CORBA.portable.ApplicationException $ex) {
                $in = $ex.getInputStream ();
                String _id = $ex.getId ();
                throw new org.omg.CORBA.MARSHAL (_id);
            } catch (org.omg.CORBA.portable.RemarshalException $rm) {
                return affirm (purchaseNo        );
            } finally {
                _releaseReply ($in);
            }
  } // affirm

  // Type-specific CORBA::Object operations
  private static String[] __ids = {
    "IDL:sellerSystem/SystemB:1.0"};

  public String[] _ids ()
  {
    return (String[])__ids.clone ();
  }

  private void readObject (java.io.ObjectInputStream s) throws java.io.IOException
  {
     String str = s.readUTF ();
     String[] args = null;
     java.util.Properties props = null;
     org.omg.CORBA.Object obj = org.omg.CORBA.ORB.init (args, props).string_to_object (str);
     org.omg.CORBA.portable.Delegate delegate = ((org.omg.CORBA.portable.ObjectImpl) obj)._get_delegate ();
     _set_delegate (delegate);
  }

  private void writeObject (java.io.ObjectOutputStream s) throws java.io.IOException
  {
     String[] args = null;
     java.util.Properties props = null;
     String str = org.omg.CORBA.ORB.init (args, props).object_to_string (this);
     s.writeUTF (str);
  }
} // class _SystemBStub
